package com.hankol.community.adapter

import com.baselibrary.utils.DoubleClickHelper
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.hankol.community.R

/**
 *@author:hanke
 *2022/3/30
 *desc:
 */
class TopicChannelAdapter : BaseQuickAdapter<String, BaseViewHolder>(R.layout.item_my_topic_channel) {
    private var selectChannelListener: SelectChannelListener? = null
    override fun convert(helper: BaseViewHolder, item: String) {
        helper.setText(R.id.tv_topic_name, item)
        helper.itemView.setOnClickListener {
            if (!DoubleClickHelper.isOnDoubleClick()) {
                selectChannelListener?.onSelectChannel(helper.layoutPosition)
            }
        }
    }
    fun setSelectChannelListener(selectChannelListener: SelectChannelListener){
        this.selectChannelListener = selectChannelListener
    }

    interface SelectChannelListener {
        fun onSelectChannel(position: Int)
    }
}